<?php

/**
 * Description of RequestTypes
 * Indonesian Brains Solutions
 * @author macbook
 * E-mail : sony@sonywibisono.com
 */
class RequestTypes {
    var $id;
var $request_type;
var $parent_id;
var $technician_group_id;
var $default_priority;
var $lead_technician;
var $hide_subject;
var $hide_request_detail;
var $detail_required;


    function open(){
        global $db;
        $sql="select * from request_types where id=$id";
        $row=$db->fetch_row($sql);
        if (!empty($row)){
            extract($row);
            $this->request_type=$request_type;
$this->parent_id=$parent_id;
$this->technician_group_id=$technician_group_id;
$this->default_priority=$default_priority;
$this->lead_technician=$lead_technician;
$this->hide_subject=$hide_subject;
$this->hide_request_detail=$hide_request_detail;
$this->detail_required=$detail_required;

        }
    }

    function openAll(){
        $sql="select * from request_types order by id asc";
        $result=$db->query($sql);
        return $db->fetch_array($result);
        
    }

    function insert(){
    global $db;
    $sql="insert into request_types values (null,'{$this->request_type}',
'{$this->parent_id}',
'{$this->technician_group_id}',
'{$this->default_priority}',
'{$this->lead_technician}',
'{$this->hide_subject}',
'{$this->hide_request_detail}',
'{$this->detail_required}',
)";
    $db->query($sql);
    return mysql_insert_id();
    }

    function update(){
        global $db;
        $sql="update request_types set request_type='{$this->request_type}',
parent_id='{$this->parent_id}',
technician_group_id='{$this->technician_group_id}',
default_priority='{$this->default_priority}',
lead_technician='{$this->lead_technician}',
hide_subject='{$this->hide_subject}',
hide_request_detail='{$this->hide_request_detail}',
detail_required='{$this->detail_required}',
 where id=".$this->id;
        $db->query($sql);
    }

    function delete(){
        global $db;
        $sql="delete from request_types where id=".$this->id;
        $db->query($sql);
    }

}

?>
